package com.lelouch.wetlandsystem.mongorepository.rocketmq;

import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;

/**
 * @author lcy
 * @create 2018-11-16 09:15
 */
public class RMProducer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("producer");
        producer.setNamesrvAddr("58.213.118.50:3076");
        producer.start();
        producer.setVipChannelEnabled(false);
        for (int i=0;i<10;i++){
            Message message = new Message("TopicTest","TagA",("Hello RocketMQ"+i).getBytes(RemotingHelper.DEFAULT_CHARSET));
            //message.setDelayTimeLevel();
            SendResult sendResult = producer.send(message);
            System.out.printf("%s%n",sendResult);

        }

        producer.shutdown();

    }
}
